{extend name="index_layout"/}
{block name="main"}
<form class="layui-form" method="post">
    
    <div class="layui-form-item">
        <label class="layui-form-label">单位 </label>
        <div class="layui-input-block">
            <input type="text" name="title" lay-verify="required" value="{$danwei.title}" autocomplete="off" placeholder="单位" class="layui-input layui-disabled">
        </div>
    </div>
    <input type="hidden" value="{$danwei.id}" name="id">
    <div class="layui-form-item">
        <label class="layui-form-label">备注 </label>
        <div class="layui-input-block">
            <textarea name="bz" id="bz" cols="30" rows="10">{$danwei.bz}</textarea>
        </div>
    </div>

    
    <div class="layui-form-item layer-footer">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit="" lay-filter='ds' type="button" data-refresh="false">立即提交</button>
            <button class="layui-btn layui-btn-normal" type="button" onclick="var index1 = parent.layer.getFrameIndex(window.name);
            parent.layer.close(index1);">返回</button>
        </div>
    </div>
</form>

{/block}

{block name="script"}
<script>
    layui.use(['form'], function() {
        var form = layui.form;
        form.on('submit(ds)',function(data){
            var param = data.field;
            $.post('{:url("editPost")}',param,function(res){
                if(res.code > 0){
                    layer.msg('修改成功');
                    setTimeout(() => {
                        var index1 = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                        parent.layer.close(index1);
                        parent.location.reload();
                    }, 500);
                }else{
                    layer.msg(res.msg);
                }
            },'json');
        })
    })
</script>
{/block}